package cn.luischen.aspect.test;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * @author 1
 */
@Component
@Aspect
@Slf4j
public class MyAopAdviseDefine {

    @Pointcut("@annotation(cn.luischen.aspect.test.MyMonitor)")
    public void pointcut() {
    }

    /**
     * 定义 advise
     */
    @Before("pointcut()")
    public void logMethodInvokeParam(JoinPoint joinPoint) {
        log.info("---Before method {} invoke, param: {}---", joinPoint.getSignature().toShortString(), joinPoint.getArgs());
    }
}